/**
 * Created by lxy_920912 on 28/03/2017.
 */
var lengthOfLastWord = function(s) {
    if(s == null || s == ''){
        return 0;
    }
    var array = s.split(' ');
    console.log(array);
    do{
        var str = array.pop();
    }while( array.length != 0 && str.length == 0);

    return str.length;
};
lengthOfLastWord("a      ")